from course import models
from rest_framework import serializers
class SerCourse(serializers.ModelSerializer):
    class Meta:
        model = models.CateModle
        # fields = '__all__'
        fields = ['id','name']
        #exclude = ['created_at','updated_at']
class SerSon(serializers.ModelSerializer):
    son= SerCourse(many=True)
    class Meta:
        model = models.CateModle
        # fields = '__all__'
        fields = ['id','name',"son"]

class Courseser(serializers.ModelSerializer):
    class Meta:
        model = models.Course
        fields = '__all__'


class MyModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.CateModle
        fields = '__all__'


class TeacherSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.Teacher
        fields = ["name","image","jobtitle","intro"]


class CourseSerializer(serializers.ModelSerializer):
    teacher = TeacherSerializer()
    class Meta:
        model = models.Course
        fields = "__all__"